﻿/**
* CircleDequeue.h
*
* Great Wisdom Confidential
* Copyright 2013 Great Wisdom Corporation. All Rights Reserved.
*
* Author: Lixin Guo
* Date: 6/6/2013
* Description: 
*/

#include "CircleDequeueBase.h"

#pragma once
using namespace std;

/**  
*  Circle dequeue class. 
*/
class DBFCircleDequeue : public CircleDequeueBase
{
public:
	/**
	* A constructor.
	* @param p_uiElementAmount Total number of elements int the queue.
	* @param p_uiElementSize Size for one element.
	* @param p_uiBeginSequence Begin sequence for this queue
	* @param p_uiEndSequence End sequence for this queue
	*/
	DBFCircleDequeue(unsigned int p_uiEntireBufferSize,unsigned int p_uiElementAmount, unsigned int p_uiElementSize,unsigned int p_uiBeginSequence,unsigned int p_uiEndSequence,unsigned char p_uiEntireDataType, unsigned char p_uiIncrementDataType);

	/**
	* Write element in the circle queue and send out the data in the element
	* @param p_uiBufferSize Size of the data need to be write
	* @param p_szBuffer Data buffer address, which should be copied into element.
	* @return Indicate whether write data is fail or successful
	*/
	virtual bool WriteData(char* p_szBuffer,unsigned int p_uiBufferSize);

	/**
	* [OLYN FOR RELAY] Write element in the circle queue and send out the data in the element
	* @param p_szBufferAddress Data buffer address, [FORMAT] CompressedHead + CompressedContent
	* @param p_uiBufferSize Size of the data need to be write
	* @param p_cType File type
	* @param p_bIsResend Indicates whether data should be resend
	* @return Indicate whether write data is fail or successful
	*/
	virtual bool WriteData(char* p_szBufferAddress, unsigned int p_uiBufferSize,  unsigned char p_cType, bool p_bIsResend);
};